import request from '@/utils/request'

/* 农田· */
// 获取农田名称
export function getFarmlandName(id) {
  return request({
    url: '/farmland/getFarmlandByID',
    method: 'get',
    params: { farmlandId: id }
  })
}
// 获取全部农田数据
export function getAllFarmland(){
  return request({
    url:'/farmland/getAllFarmland',
    method:'get'
  })
}
// 新增农田
export function addFarmland(data){
  return request({
    url:'/farmland/addFarmland',
    method:'post',
    data
  })
}
// 修改农田
export function modifyFarmland(data){
  return request({
    url:'/farmland/modifyFarmland',
    method:'put',
    data
  })
}

// 删除农田
export function deleteFarmland(id){
  return request({
    url:"/farmland/deleteFarmland",
    method:'get',
    params:{ id:id }
  })
}

/* 土壤墒情 */
// 根据农田id获取土壤墒情
export function getSoilData(id){
  return request({
    url:'/solid/getSolidData',
    method:'get',
    params:{
      farmlandId:id
    }
  })
}

/* 病虫害 */
// 根据农田id获取病虫害数据
export function getPestDiseaseData(id){
  return request({
    url:'/pestdisease/getPestDiseaseData',
    method:'get',
    params:{
      farmlandId:id
    }
  })
}

/* 天气 */
// 获取全部天气信息
export function getWeatherData(){
  return request({
    url:'weather/getWeatherData',
    method:'get'
  })
}